#include <iostream>
#include <thread>

class A {
public:
    void foo () {

        std::cout << "program is running ..." << std::endl;
    }
};

int main() {

    // A a;
    std::shared_ptr<A> a = std::make_shared<A>(); // 使用智能指针，会在对象a使用完后自动调用其析构函数释放
    std::thread t1(&A::foo, a);

    t1.join();

    return 0;
}